{
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Partial Least Squares Regression (PLSR)"
      ],
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "import numpy as np\n",
        "import matplotlib.pyplot as plt\n",
        "import pandas as pd\n",
        "\n",
        "import warnings\n",
        "warnings.filterwarnings(\"ignore\")\n",
        "\n",
        "import yfinance as yf\n",
        "yf.pdr_override()"
      ],
      "outputs": [],
      "execution_count": 1,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:50.233Z",
          "iopub.execute_input": "2020-05-25T04:04:50.239Z",
          "iopub.status.idle": "2020-05-25T04:04:51.451Z",
          "shell.execute_reply": "2020-05-25T04:04:52.793Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# input\n",
        "symbol = 'AMD'\n",
        "start = '2014-01-01'\n",
        "end = '2018-08-27'\n",
        "\n",
        "# Read data \n",
        "dataset = yf.download(symbol,start,end)\n",
        "\n",
        "# Only keep close columns \n",
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "[*********************100%***********************]  1 of 1 completed\n"
          ]
        },
        {
          "output_type": "execute_result",
          "execution_count": 2,
          "data": {
            "text/plain": [
              "            Adj Close  Close  High   Low  Open    Volume\n",
              "Date                                                    \n",
              "2014-01-02       3.95   3.95  3.98  3.84  3.85  20548400\n",
              "2014-01-03       4.00   4.00  4.00  3.88  3.98  22887200\n",
              "2014-01-06       4.13   4.13  4.18  3.99  4.01  42398300\n",
              "2014-01-07       4.18   4.18  4.25  4.11  4.19  42932100\n",
              "2014-01-08       4.18   4.18  4.26  4.14  4.23  30678700"
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Close</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Open</th>\n",
              "      <th>Volume</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2014-01-02</th>\n",
              "      <td>3.95</td>\n",
              "      <td>3.95</td>\n",
              "      <td>3.98</td>\n",
              "      <td>3.84</td>\n",
              "      <td>3.85</td>\n",
              "      <td>20548400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-03</th>\n",
              "      <td>4.00</td>\n",
              "      <td>4.00</td>\n",
              "      <td>4.00</td>\n",
              "      <td>3.88</td>\n",
              "      <td>3.98</td>\n",
              "      <td>22887200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-06</th>\n",
              "      <td>4.13</td>\n",
              "      <td>4.13</td>\n",
              "      <td>4.18</td>\n",
              "      <td>3.99</td>\n",
              "      <td>4.01</td>\n",
              "      <td>42398300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-07</th>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.25</td>\n",
              "      <td>4.11</td>\n",
              "      <td>4.19</td>\n",
              "      <td>42932100</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-08</th>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.26</td>\n",
              "      <td>4.14</td>\n",
              "      <td>4.23</td>\n",
              "      <td>30678700</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 2,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:51.461Z",
          "iopub.execute_input": "2020-05-25T04:04:51.466Z",
          "iopub.status.idle": "2020-05-25T04:04:52.767Z",
          "shell.execute_reply": "2020-05-25T04:04:52.795Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset['Increase_Decrease'] = np.where(dataset['Volume'].shift(-1) > dataset['Volume'],1,0)\n",
        "dataset['Buy_Sell_on_Open'] = np.where(dataset['Open'].shift(-1) > dataset['Open'],1,0)\n",
        "dataset['Buy_Sell'] = np.where(dataset['Adj Close'].shift(-1) > dataset['Adj Close'],1,0)\n",
        "dataset['Returns'] = dataset['Adj Close'].pct_change()\n",
        "dataset = dataset.dropna()"
      ],
      "outputs": [],
      "execution_count": 3,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:52.774Z",
          "iopub.execute_input": "2020-05-25T04:04:52.779Z",
          "iopub.status.idle": "2020-05-25T04:04:52.803Z",
          "shell.execute_reply": "2020-05-25T04:04:52.798Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset.tail()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 4,
          "data": {
            "text/plain": [
              "            Adj Close      Close   High        Low       Open     Volume  \\\n",
              "Date                                                                       \n",
              "2018-08-20  19.980000  19.980000  20.08  19.350000  19.790001   62983200   \n",
              "2018-08-21  20.400000  20.400000  20.42  19.860001  19.980000   55629000   \n",
              "2018-08-22  20.900000  20.900000  20.92  20.209999  20.280001   62002700   \n",
              "2018-08-23  22.290001  22.290001  22.32  21.139999  21.190001  113444100   \n",
              "2018-08-24  23.980000  23.980000  24.00  22.670000  22.910000  164328200   \n",
              "\n",
              "            Increase_Decrease  Buy_Sell_on_Open  Buy_Sell   Returns  \n",
              "Date                                                                 \n",
              "2018-08-20                  0                 1         1  0.010622  \n",
              "2018-08-21                  1                 1         1  0.021021  \n",
              "2018-08-22                  1                 1         1  0.024510  \n",
              "2018-08-23                  1                 1         1  0.066507  \n",
              "2018-08-24                  0                 0         0  0.075819  "
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Close</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Open</th>\n",
              "      <th>Volume</th>\n",
              "      <th>Increase_Decrease</th>\n",
              "      <th>Buy_Sell_on_Open</th>\n",
              "      <th>Buy_Sell</th>\n",
              "      <th>Returns</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2018-08-20</th>\n",
              "      <td>19.980000</td>\n",
              "      <td>19.980000</td>\n",
              "      <td>20.08</td>\n",
              "      <td>19.350000</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>62983200</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.010622</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-21</th>\n",
              "      <td>20.400000</td>\n",
              "      <td>20.400000</td>\n",
              "      <td>20.42</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.980000</td>\n",
              "      <td>55629000</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.021021</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-22</th>\n",
              "      <td>20.900000</td>\n",
              "      <td>20.900000</td>\n",
              "      <td>20.92</td>\n",
              "      <td>20.209999</td>\n",
              "      <td>20.280001</td>\n",
              "      <td>62002700</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.024510</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-23</th>\n",
              "      <td>22.290001</td>\n",
              "      <td>22.290001</td>\n",
              "      <td>22.32</td>\n",
              "      <td>21.139999</td>\n",
              "      <td>21.190001</td>\n",
              "      <td>113444100</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.066507</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-24</th>\n",
              "      <td>23.980000</td>\n",
              "      <td>23.980000</td>\n",
              "      <td>24.00</td>\n",
              "      <td>22.670000</td>\n",
              "      <td>22.910000</td>\n",
              "      <td>164328200</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0.075819</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 4,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:52.810Z",
          "iopub.execute_input": "2020-05-25T04:04:52.816Z",
          "iopub.status.idle": "2020-05-25T04:04:52.828Z",
          "shell.execute_reply": "2020-05-25T04:04:53.600Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Define X\n",
        "X = np.asarray(dataset[['Open', 'High', 'Low', 'Adj Close', 'Volume']])\n",
        "X[0:5]"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 5,
          "data": {
            "text/plain": [
              "array([[3.98000002e+00, 4.00000000e+00, 3.88000011e+00, 4.00000000e+00,\n",
              "        2.28872000e+07],\n",
              "       [4.01000023e+00, 4.17999983e+00, 3.99000001e+00, 4.13000011e+00,\n",
              "        4.23983000e+07],\n",
              "       [4.19000006e+00, 4.25000000e+00, 4.11000013e+00, 4.17999983e+00,\n",
              "        4.29321000e+07],\n",
              "       [4.23000002e+00, 4.26000023e+00, 4.13999987e+00, 4.17999983e+00,\n",
              "        3.06787000e+07],\n",
              "       [4.19999981e+00, 4.23000002e+00, 4.05000019e+00, 4.09000015e+00,\n",
              "        3.06676000e+07]])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 5,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:52.834Z",
          "iopub.execute_input": "2020-05-25T04:04:52.839Z",
          "iopub.status.idle": "2020-05-25T04:04:52.849Z",
          "shell.execute_reply": "2020-05-25T04:04:53.604Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Define y\n",
        "y = np.asarray(dataset['Buy_Sell'])\n",
        "y[0:5]"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 6,
          "data": {
            "text/plain": [
              "array([1, 1, 0, 0, 1])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 6,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:52.858Z",
          "iopub.execute_input": "2020-05-25T04:04:52.863Z",
          "iopub.status.idle": "2020-05-25T04:04:52.874Z",
          "shell.execute_reply": "2020-05-25T04:04:53.608Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn import preprocessing\n",
        "X = preprocessing.StandardScaler().fit(X).transform(X)\n",
        "X[0:5]"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 7,
          "data": {
            "text/plain": [
              "array([[-0.62250216, -0.63550706, -0.62613809, -0.61792054, -0.43967264],\n",
              "       [-0.61632107, -0.59915373, -0.60299004, -0.59116896,  0.14205802],\n",
              "       [-0.5792348 , -0.58501628, -0.57773758, -0.58087996,  0.15797346],\n",
              "       [-0.57099341, -0.58299661, -0.57142453, -0.58087996, -0.20736619],\n",
              "       [-0.5771745 , -0.58905554, -0.59036379, -0.5994002 , -0.20769714]])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 7,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:52.881Z",
          "iopub.execute_input": "2020-05-25T04:04:52.885Z",
          "iopub.status.idle": "2020-05-25T04:04:53.355Z",
          "shell.execute_reply": "2020-05-25T04:04:53.610Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Splitting the dataset into the Training set and Test set\n",
        "from sklearn.model_selection import train_test_split\n",
        "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 0)\n",
        "print ('Train set:', X_train.shape,  y_train.shape)\n",
        "print ('Test set:', X_test.shape,  y_test.shape)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Train set: (877, 5) (877,)\n",
            "Test set: (293, 5) (293,)\n"
          ]
        }
      ],
      "execution_count": 8,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.365Z",
          "iopub.execute_input": "2020-05-25T04:04:53.369Z",
          "iopub.status.idle": "2020-05-25T04:04:53.389Z",
          "shell.execute_reply": "2020-05-25T04:04:53.613Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.cross_decomposition import PLSRegression"
      ],
      "outputs": [],
      "execution_count": 9,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.401Z",
          "iopub.execute_input": "2020-05-25T04:04:53.408Z",
          "iopub.status.idle": "2020-05-25T04:04:53.417Z",
          "shell.execute_reply": "2020-05-25T04:04:53.615Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "pls = PLSRegression(n_components=2)\n",
        "pls"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 10,
          "data": {
            "text/plain": [
              "PLSRegression(copy=True, max_iter=500, n_components=2, scale=True, tol=1e-06)"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 10,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.426Z",
          "iopub.execute_input": "2020-05-25T04:04:53.435Z",
          "iopub.status.idle": "2020-05-25T04:04:53.452Z",
          "shell.execute_reply": "2020-05-25T04:04:53.617Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "pls.fit(X_train, y_train)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 11,
          "data": {
            "text/plain": [
              "PLSRegression(copy=True, max_iter=500, n_components=2, scale=True, tol=1e-06)"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 11,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.465Z",
          "iopub.execute_input": "2020-05-25T04:04:53.471Z",
          "iopub.status.idle": "2020-05-25T04:04:53.482Z",
          "shell.execute_reply": "2020-05-25T04:04:53.619Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "pls.coef_"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 12,
          "data": {
            "text/plain": [
              "array([[ 0.01054254],\n",
              "       [ 0.00831933],\n",
              "       [ 0.00876765],\n",
              "       [ 0.00707311],\n",
              "       [-0.01475987]])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 12,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.489Z",
          "iopub.execute_input": "2020-05-25T04:04:53.495Z",
          "iopub.status.idle": "2020-05-25T04:04:53.503Z",
          "shell.execute_reply": "2020-05-25T04:04:53.621Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "y_pred = pls.predict(X_test)"
      ],
      "outputs": [],
      "execution_count": 14,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.518Z",
          "iopub.execute_input": "2020-05-25T04:04:53.522Z",
          "iopub.status.idle": "2020-05-25T04:04:53.532Z",
          "shell.execute_reply": "2020-05-25T04:04:53.624Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.metrics import mean_squared_error\n",
        "print('The rmse of prediction is:', mean_squared_error(y_test, y_pred) ** 0.5)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The rmse of prediction is: 0.4999469005075853\n"
          ]
        }
      ],
      "execution_count": 15,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.543Z",
          "iopub.execute_input": "2020-05-25T04:04:53.549Z",
          "iopub.status.idle": "2020-05-25T04:04:53.564Z",
          "shell.execute_reply": "2020-05-25T04:04:53.627Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "pls.score(X_test, y_test)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 16,
          "data": {
            "text/plain": [
              "-7.884525222578986e-05"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 16,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-25T04:04:53.571Z",
          "iopub.execute_input": "2020-05-25T04:04:53.579Z",
          "iopub.status.idle": "2020-05-25T04:04:53.588Z",
          "shell.execute_reply": "2020-05-25T04:04:53.630Z"
        }
      }
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "python3"
    },
    "language_info": {
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "pygments_lexer": "ipython3",
      "codemirror_mode": {
        "version": 3,
        "name": "ipython"
      },
      "nbconvert_exporter": "python",
      "version": "3.5.5",
      "name": "python"
    },
    "kernelspec": {
      "argv": [
        "C:\\Users\\Tin Hang\\Anaconda3\\envs\\py35\\python.exe",
        "-m",
        "ipykernel_launcher",
        "-f",
        "{connection_file}"
      ],
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "nteract": {
      "version": "0.23.1"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}